package com.wkr.order.controller;

import com.wkr.common.CommonResponse;
import com.wkr.order.service.IStoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/store/train")
@Slf4j
public class StoreController {

    @Autowired
    private IStoreService trainStoreServiceImpl;

    @PostMapping("/update")
    public CommonResponse<Boolean> updateStore() {
        try {
            trainStoreServiceImpl.update();
        } catch (Exception e) {
            log.error("更新库存异常", e);
            return CommonResponse.fail("-1", e.getMessage());
        }
        return CommonResponse.success(Boolean.TRUE);
    }
}
